package com.jinke.api.modules.runnable;

import com.jinke.api.modules.app.model.OrderTaskDetail;
import com.jinke.api.modules.ums.model.UmsAdmin;

/**
 * 下单 批量下单准备重构
 */
public class CreateLabelTask implements Runnable {


    private  OrderTaskDetail taskDetail;
//
    private Account account;


    /**
     * 后面再重构定时下单
     */
    //@RequestMapping(value = "/test", method = RequestMethod.GET)
//    public void taskForTODO() {
//        log.info("==================批量下单定时任务开始=============");
//        //查询订单定时详情表中还未执行的数据
//        List<OrderTaskDetail> orderTaskDetails = iOrderTaskDetailService.lambdaQuery()
//                .isNull(OrderTaskDetail::getStatus)
//                .eq(OrderTaskDetail::getOperate, 1)
//                .list();
//        //按用户分组查 子任务循环
//        if (CollectionUtil.isNotEmpty(orderTaskDetails)) {
//            if (orderTaskDetails.size() >= 20) {
//                orderTaskDetails = orderTaskDetails.subList(0, 20);
//            }
//            log.info("=========批量下单执行数据==========orderIds,{}", JSON.toJSONString(orderTaskDetails.stream().map(OrderTaskDetail::getOrderId).collect(Collectors.toList())));
//            //开启多线程
//            for (OrderTaskDetail taskDetail : orderTaskDetails) {
////                Thread t2 = new Thread(new CreateLabelTask(account, 60.0), "Thread2");
////                t1.start();
//            }
//            log.info("=============批量下单定时任务执行结束================");
//        }
//    }
    public CreateLabelTask(UmsAdmin umsAdmin, OrderTaskDetail taskDetail) {

        //扣totalAmount的相关参数都在传入
        this.account=new Account(umsAdmin);
        this.taskDetail=taskDetail;

    }

    /**
     * When an object implementing interface <code>Runnable</code> is used
     * to create a thread, starting the thread causes the object's
     * <code>run</code> method to be called in that separately executing
     * thread.
     * <p>
     * The general contract of the method <code>run</code> is that it may
     * take any action whatsoever.
     *
     * @see Thread#run()
     */
    @Override
    public void run() {

    }
}
